<?php
use Nette\Application\UI\Form;
class PackageListPresenter extends LoggedPresenter0 {
	
	private $packageModel;
	private $roleModel;
	private $packageStateModel;
	
	protected function startup() {
		parent::startup ();
		$this->packageModel = $this->context->packageModel;
		$this->roleModel = $this->context->roleModel;
		$this->packageStateModel = $this->context->packageStateModel;
	}
	
	public function renderDefault() {
		
		$recipientPackages = $this->roleModel->searchRoleByRole('RECIPIENT');
		$this->template->recipientPackages = $recipientPackages;
		/*
		$refpackage = $this->roleModel->getPackageList('RECIPIENT');
		$recipient = $this->packageModel->getPackageInfo($refpackage);
		
		foreach($recipient as $rec){ //pro kazdy balik
			$zatimPOleProtozeNeumimeVracetJeden = $this->packageStateModel->getPackageState($rec->serno); //vymenit za metodu, ktera bdue vracet jeden radek
			$rec["stavy"] = $zatimPOleProtozeNeumimeVracetJeden;	
		}
		//print_r($recipient[1]["posledniStav"]);
		$this->template->packagerecipient = $recipient;
		
		//v roli SENDER
		$refpackage = $this->roleModel->getPackageList('SENDER');
		$this->template->packagesender = $this->packageModel->getPackageInfo($refpackage);
		
		
		$packageDomain = $this->packageModel->findPackage(1);
		$this->template->packagedomain = $packageDomain;	
		
		$packageInfo = $this->context->packageInfoService->findByRefPackage(1);
		*/
		
	}

}
